#include <vector>
#include <string>
#include <unordered_map>
#include <iostream>
#include <time.h>
using namespace std;
class Solution
{
public:
    string convert(string s, int numRows)
    {
        int len = s.size();
        string ans[numRows];
        int flag = 1, time = 0;
        if (numRows == 1)
            return s;
        for (int i = 0; i < len; ++i)
        {
            ans[time].push_back(s[i]);
            if (time == numRows - 1)
                flag = -1;
            else if (time == 0)
                flag = 1;
            time += flag;
        }
        for (int i = 1; i < numRows; ++i)
            ans[0] += ans[i];
        return ans[0];
    }
};